import {option} from "@/api/http.js"

export function createBorrow(form){
  return option({
    url:'borrow/createBorrow',
    method:'post',
    data:form,
    headers:{
      'Content-Type': 'multipart/form-data'
    }
  })
}

export function getMyBorrows(userId){
  return option({
    url:'borrow/getMyBorrow',
    method:'post',
    data:{
      userId
    },
  })
}


export function getMyComBorrows(userId){
  return option({
    url:'borrow/getMyCompletedBorrow',
    method:'post',
    data:{
      userId
    },
  })
}


export function getMyGoingBorrows(userId){
  return option({
    url:'borrow/getMyGoingBorrow',
    method:'post',
    data:{
      userId
    },
  })
}


export function getMyBorrowCopies(userId){
  return option({
    url:'borrow/getMyCopy',
    method:'post',
    data:{
      userId
    },
  })
}

export function getMyBorrowWorks(userId){
  return option({
    url:'borrow/getMyWorks',
    method:'post',
    data:{
      userId
    },
  })
}

export function getMyBorrowGoingWorks(userId){
  return option({
    url:'borrow/getMyGoingWork',
    method:'post',
    data:{
      userId
    },
  })
}


export function getMyBorrowComWorks(userId){
  return option({
    url:'borrow/getCompletedWork',
    method:'post',
    data:{
      userId
    },
  })
}


export function previewBorrow(borrowId){
  return option({
    url:'borrow/previewBorrow',
    method:'post',
    data:{
      borrowId
    },
    responseType:'blob'
  })
}


export function downloadBorrow(borrowId){
  return option({
    url:'borrow/downloadBorrow',
    method:'post',
    data:{
      borrowId
    },
    responseType:'blob'
  })
}


export function previewBorrowHistory(borrowHistoryId){
  return option({
    url:'borrow/previewBorrowHistory',
    method:'post',
    data:{
      borrowHistoryId
    },
    responseType:'blob'
  })
}


export function downloadBorrowHistory(borrowHistoryId){
  return option({
    url:'borrow/downloadBorrowHistory',
    method:'post',
    data:{
      borrowHistoryId
    },
    responseType:'blob'
  })
}


export function doBorrowCheck(form){
  return option({
    url:'borrow/doBorrowCheck',
    method:'post',
    data:form,
    headers:{
      'Content-Type': 'multipart/form-data'
    }
  })
}


export function getBorrowById(borrowId){
  return option({
    url:'borrow/getBorrowById',
    method:'post',
    data:{
      borrowId
    },
  })
}


export function getBorrowHistory(borrowId){
  return option({
    url:'borrow/getBorrowHistory',
    method:'post',
    data:{
      borrowId
    },
  })
}


export function resubmitBorrow(form){
  return option({
    url:'borrow/resubmitBorrow',
    method:'post',
    data:form,
    headers:{
      'Content-Type': 'multipart/form-data'
    }
  })
}


export function getBUnread(userId){
  return option({
    url:'borrow/getUnread',
    method:'post',
    data:{
      userId
    },
  })
}

export function getTotalCount(userId){
  return option({
    url:'borrow/getTotalCount',
    method:'post',
    data:{
      userId,
    },
  })
}

export function searchMineByWord(userId,keyword){
  return option({
    url:'borrow/searchMineByWord',
    method:'post',
    data:{
      userId,
      keyword
    },
  })
}

export function searchWorkByWord(userId,keyword){
  return option({
    url:'borrow/searchWorkByWord',
    method:'post',
    data:{
      userId,
      keyword
    },
  })
}


